#import os
import paramiko

server='172.19.11.16'
username='oracle'
password='Ora!1116'
remote_path=r"/oracle/app/oracle/admin/acct/bdump"
remote_filename=r"alert.log"
local_path=r"D:/work/[python]/DBS/Log_MultiAnalysis/logs"
local_filename=remote_filename

socks=(server,22)
testssh=paramiko.Transport(socks)
testssh.connect(username=username,password=password)
sftptest=paramiko.SFTPClient.from_transport(testssh)
sftptest.get(remote_path + '/' + remote_filename, local_path + '/' + local_filename)
sftptest.close()
testssh.close()

#conn to server
#ssh = paramiko.SSHClient()
#ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
#ssh.load_host_keys(os.path.expanduser(os.path.join("~",".ssh","known_hosts")))
#ssh.connect(server,username=username,password=password)
#exec command
#stdin,stdout,stderr = ssh.exec_command(cmd)
#stdin.write('secretn')
#stdin.flush()
#print stdout.readlines()
#ssh.close()




